home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / SAT / SAT C Lib ƒ / SAT.h next >
Encoding:
C/C++ Source or Header  |  1993-09-21  |  5.3 KB  |  148 lines  |  [TEXT/KAHL]

  1. /* #include file for the C interface to SAT */
  2.  
  3. /* Comment out under TC5: */
  4. /*#include <Color.h>*/
  5. /*#include <WindowMgr.h>*/
  6. /*#include <DialogMgr.h>*/
  7.  
  8.  
  9.  
  10. #ifndef true
  11. #define true 1
  12. #endif
  13.  
  14. #ifndef false
  15. #define false 0
  16. #endif
  17.  
  18. #ifndef nil
  19. #define nil 0L
  20. #endif
  21.  
  22.     typedef struct face {
  23.         char            *colorData;
  24.         int            resNum;
  25.         BitMap        iconMask;
  26.         int            rowBytes; /* Note! No flags in the highest bits!*/
  27.         struct face    *next;
  28.         RgnHandle        maskRgn;
  29.         } Face, *FacePtr;
  30.  
  31.     typedef struct sprite {
  32. /* Variables that you should change as appropriate */
  33.         int            kind;
  34.         Point            position;    
  35.         Rect            hotrect, hotrect2;
  36.         FacePtr        face;
  37.         ProcPtr        task;
  38.         ProcPtr        hittask;
  39. /* SAT variables that you shouldn't change: */
  40.         Point            oldpos;
  41.         struct sprite    *next, *prev;
  42.         Rect            r, oldr;
  43. /* Variables for free use by the application: */
  44.         int            layer;
  45.         Point            speed;
  46.         int            mode;
  47.         Ptr            appPtr;
  48.         long            appLong;
  49.         } Sprite, *SpritePtr;
  50.  
  51. typedef struct{
  52.         int    patternType;     /* 1 = Pattern, PatHandle, 2 = PixPat, PixPatHandle */
  53.         PixPatHandle    thePat;         /* or PatHandle */
  54.         }    SATPattern, *SATPatPtr, **SATPatHandle;
  55.  
  56. /* Constants for ConfigureSAT */
  57.     enum{VPositionSort=0, LayerSort, NoSort};
  58.     enum{KindCollision=0, ForwardCollision, BackwardCollision, NoCollision};
  59.  
  60. /* Global variables */
  61.     extern WindowPtr SATwind;        /* The window that SAT draws in. */
  62.     extern GrafPtr offScreen;        /* Offscreen image */
  63.     extern GrafPtr backScreen;        /* Background image */
  64.     extern GDHandle offScreenGD, backScreenGD;    /*Graphic devices for offScreen and BackScreen*/
  65.     extern long ox,oy;                /* Origin-variables, tells SAT where in the window to draw*/
  66.     extern int SATpict, SATbwpict;    /* PICT resource IDs, value 0 ignored */
  67.  
  68. /* Screen size parameters. */
  69. /* Usually, you will only need to inspect OurDepth, ColorFlag, OffSizeH and OffSizeV */
  70. /* The others are subject to change or go away */
  71.     extern PixMapHandle ourScreen;
  72.     extern Ptr ourBaseAddr;
  73.     extern int ourRowBytes;
  74.     extern Rect ourBounds;
  75.     extern int ourDepth;    /* Depth of screen and offscreens */
  76.     extern Boolean colorFlag; /* Is this Mac color capable? */
  77.     extern Boolean anyMonsters; /* False when no sprites with kind < -1 are active, KindCollision only */
  78.  
  79.     extern int offSizeH, offSizeV; /* Size of the animation area - use for border checks */
  80.  
  81. /*Utilities*/
  82.     pascal void DrawInt (int);
  83.     pascal void DrawLong (long);
  84.     pascal int Rand (int);
  85.     pascal int Rand10();
  86.     pascal int Rand100();
  87.     pascal void ReportStr (Str255);
  88.     pascal Boolean QuestionStr(Str255);
  89.     pascal void CheckNoMem (Ptr);
  90.     pascal void SetMouse (Point);
  91. /* Pattern utilities */
  92.     pascal void SATPenPat (SATPatHandle);
  93.     pascal void SATBackPat (SATPatHandle);
  94.     pascal SATPatHandle SATGetPat (int);
  95.     pascal void SATDisposePat (SATPatHandle);
  96.  
  97. /*Sound*/
  98.     pascal void InitSATSound();            /* No longer necessary */
  99.     pascal void SATSoundPlay (Handle, int, Boolean);    /* Play sounds with priority handling */
  100.     pascal void SATSoundShutup();        /*Silence, dispose of sound channel*/
  101.     pascal void SATSoundEvents();        /* Call this once in a while when not calling RunSAT often */
  102.     pascal Boolean SATSoundDone();    /* Any sound going on?*/
  103.     pascal Handle SATGetSound (int);
  104.     pascal Handle SATGetNamedSound (Str255);
  105.     pascal void SATDisposeSound (Handle);
  106.     pascal void SATSoundOn();
  107.     pascal void SATSoundOff();
  108.  
  109. /* SAT routines */
  110.  
  111. /* Initialization */
  112.     pascal void ConfigureSAT(Boolean, int, int, int);
  113.     pascal WindowPtr InitSAT (int, int, int, int);
  114.     pascal WindowPtr CustomInitSAT (int, int, Rect, WindowPtr, GDHandle, Boolean, Boolean, Boolean, Boolean);
  115. /* Maintainance, background manipulation etc. */
  116.     pascal Boolean SATDepthChangeTest();
  117.     pascal void SATDrawPICTs (int, int);
  118.     pascal void PeekOffscreen();
  119. /* Drawing */
  120.     pascal void SATPlotFace(FacePtr, GrafPtr, GDHandle, Point, Boolean); /*Draw a Face (icon).*/
  121.     pascal void SATPlotFaceToScreen(FacePtr, Point, Boolean); /*NEW*/
  122.     pascal void SATCopyBits(GrafPtr, GrafPtr, GDHandle, Point, Point, int,int,Boolean); /*NEW*/
  123.     pascal void SATCopyBitsToScreen(GrafPtr,Point,Point,int,int,Boolean); /*NEW*/
  124.     pascal void SATBackChanged (Rect); /*Tell SAT about changes in BackScreen*/
  125.     pascal void SATSetPortOffScreen(); /*Use before Quick-Drawing on offScreen*/
  126.     pascal void SATSetPortBackScreen(); /*Use before Quick-Drawing on BackScreen*/
  127.     pascal void SATSetPortScreen(); /*Use to restore after drawing off/backscreen*/
  128. /* Sprite handling */
  129.     pascal FacePtr GetFace (int);
  130.     pascal void DisposeFace (FacePtr);
  131.     pascal SpritePtr NewSprite (int,int,int, ProcPtr, ProcPtr, ProcPtr);
  132.     pascal SpritePtr NewSpriteAfter (SpritePtr,int,int,int, ProcPtr, ProcPtr, ProcPtr);
  133.     pascal void KillSprite (SpritePtr);
  134. /* Animating */
  135.     pascal void RunSAT (Boolean);
  136. /* Menu bar */
  137.     pascal void ShowMBar();
  138.     pascal void HideMBar(WindowPtr);
  139. /* Advanced special-purpose calls */
  140.     pascal void SATInstallSynch (ProcPtr);
  141.     pascal void SATSetSpriteRecSize (long);
  142.     pascal void SkipSAT();
  143. /* Offscreen - use only if you need an *extra* offscreen buffer. These calls are likely to change in the future!*/
  144.     pascal void SATMakeOffscreen (GrafPtr*, Rect, GDHandle*); /*Make offscreen buffer in current screen depth and CLUT.*/
  145.     pascal void SATDisposeOffScreen (GrafPtr, GDHandle); /*Get rid of offscreen*/
  146.     pascal OSErr CreateOffScreen (Rect, int, CTabHandle, CGrafPtr*, GDHandle*); /*From Principia Offscreen*/
  147.     pascal void DisposeOffScreen (CGrafPtr, GDHandle);/*From Principia Offscreen*/
  148.